class ADC_sensor_loop:
    def __init__(self,pin_list):
        self.adc=[]

        for i in pin_list:
            self.adc.append(ADC(Pin(i)))
        for i in self.adc:
            i.atten(ADC.ATTN_11DB)
            
    def read_value():
        a=[0,0,0,0] # 零点偏差
        for i in self.adc:
            n=self.adc.index(i)
            a[n]=i.read()+a[n]
        return a
    
class ADC_sensor:
    def __init__(self):
        self.in1 = ADC(Pin(2))
        self.in2 = ADC(Pin(3))
        self.in3 = ADC(Pin(5))
        self.in4 = ADC(Pin(4))
        self.in1.atten(ADC.ATTN_11DB)  # 这里配置测量量程为3.3V
        self.in2.atten(ADC.ATTN_11DB)
        self.in3.atten(ADC.ATTN_11DB)
        self.in4.atten(ADC.ATTN_11DB)
        self.wf1=Wave_filtering(500)
        self.wf2=Wave_filtering(500)
        self.wf3=Wave_filtering(500)
        self.wf4=Wave_filtering(500)
           
    def read_value(self):
        v1=self.in1.read()+0 # 消除零点偏差
        v2=self.in2.read()+0
        v3=self.in3.read()+0
        v4=self.in4.read()+0
        v1=self.wf1.filtering(v1)
        v2=self.wf2.filtering(v2)
        v3=self.wf3.filtering(v3)
        v4=self.wf4.filtering(v4)
        return (v1,v2,v3,v4)